\(\int \sqrt {-1-\cot ^2(x)} \, dx\) [12]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [C] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [C] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 12, antiderivative size = 14 \[ \int \sqrt {-1-\cot ^2(x)} \, dx=\arctan \left (\frac {\cot (x)}{\sqrt {-\csc ^2(x)}}\right ) \]

[Out]

arctan(cot(x)/(-csc(x)^2)^(1/2))

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3738, 4207, 223, 209} \[ \int \sqrt {-1-\cot ^2(x)} \, dx=\arctan \left (\frac {\cot (x)}{\sqrt {-\csc ^2(x)}}\right ) \]

[In]

Int[Sqrt[-1 - Cot[x]^2],x]

[Out]

ArcTan[Cot[x]/Sqrt[-Csc[x]^2]]

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 223

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Subst[Int[1/(1 - b*x^2), x], x, x/Sqrt[a + b*x^2]] /; FreeQ[{a,
b}, x] &&  !GtQ[a, 0]

Rule 3738

Int[(u_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> Int[ActivateTrig[u*(a*sec[e + f*x]^2)^p]
, x] /; FreeQ[{a, b, e, f, p}, x] && EqQ[a, b]

Rule 4207

Int[((b_.)*sec[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[b*(ff/
f), Subst[Int[(b + b*ff^2*x^2)^(p - 1), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{b, e, f, p}, x] &&  !IntegerQ[p
]

Rubi steps \begin{align*} \text {integral}& = \int \sqrt {-\csc ^2(x)} \, dx \\ & = \text {Subst}\left (\int \frac {1}{\sqrt {-1-x^2}} \, dx,x,\cot (x)\right ) \\ & = \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\frac {\cot (x)}{\sqrt {-\csc ^2(x)}}\right ) \\ & = \arctan \left (\frac {\cot (x)}{\sqrt {-\csc ^2(x)}}\right ) \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(30\) vs. \(2(14)=28\).

Time = 0.04 (sec) , antiderivative size = 30, normalized size of antiderivative = 2.14 \[ \int \sqrt {-1-\cot ^2(x)} \, dx=\frac {\csc (x) \left (\log \left (\cos \left (\frac {x}{2}\right )\right )-\log \left (\sin \left (\frac {x}{2}\right )\right )\right )}{\sqrt {-\csc ^2(x)}} \]

[In]

Integrate[Sqrt[-1 - Cot[x]^2],x]

[Out]

(Csc[x]*(Log[Cos[x/2]] - Log[Sin[x/2]]))/Sqrt[-Csc[x]^2]

Maple [A] (verified)

Time = 0.04 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.07

method result size
derivativedivides \(\arctan \left (\frac {\cot \left (x \right )}{\sqrt {-1-\cot \left (x \right )^{2}}}\right )\) \(15\)
default \(\arctan \left (\frac {\cot \left (x \right )}{\sqrt {-1-\cot \left (x \right )^{2}}}\right )\) \(15\)
risch \(-2 \sqrt {\frac {{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}-1\right )^{2}}}\, \ln \left ({\mathrm e}^{i x}+1\right ) \sin \left (x \right )+2 \sqrt {\frac {{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}-1\right )^{2}}}\, \ln \left ({\mathrm e}^{i x}-1\right ) \sin \left (x \right )\) \(60\)

[In]

int((-1-cot(x)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

arctan(cot(x)/(-1-cot(x)^2)^(1/2))

Fricas [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.28 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.36 \[ \int \sqrt {-1-\cot ^2(x)} \, dx=i \, \log \left (e^{\left (i \, x\right )} + 1\right ) - i \, \log \left (e^{\left (i \, x\right )} - 1\right ) \]

[In]

integrate((-1-cot(x)^2)^(1/2),x, algorithm="fricas")

[Out]

I*log(e^(I*x) + 1) - I*log(e^(I*x) - 1)

Sympy [F]

\[ \int \sqrt {-1-\cot ^2(x)} \, dx=\int \sqrt {- \cot ^{2}{\left (x \right )} - 1}\, dx \]

[In]

integrate((-1-cot(x)**2)**(1/2),x)

[Out]

Integral(sqrt(-cot(x)**2 - 1), x)

Maxima [A] (verification not implemented)

none

Time = 0.34 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.21 \[ \int \sqrt {-1-\cot ^2(x)} \, dx=-\arctan \left (\sin \left (x\right ), \cos \left (x\right ) + 1\right ) + \arctan \left (\sin \left (x\right ), \cos \left (x\right ) - 1\right ) \]

[In]

integrate((-1-cot(x)^2)^(1/2),x, algorithm="maxima")

[Out]

-arctan2(sin(x), cos(x) + 1) + arctan2(sin(x), cos(x) - 1)

Giac [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.28 (sec) , antiderivative size = 11, normalized size of antiderivative = 0.79 \[ \int \sqrt {-1-\cot ^2(x)} \, dx=i \, \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right ) \mathrm {sgn}\left (\sin \left (x\right )\right ) \]

[In]

integrate((-1-cot(x)^2)^(1/2),x, algorithm="giac")

[Out]

I*log(abs(tan(1/2*x)))*sgn(sin(x))

Mupad [B] (verification not implemented)

Time = 12.87 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00 \[ \int \sqrt {-1-\cot ^2(x)} \, dx=\mathrm {atan}\left (\frac {\mathrm {cot}\left (x\right )}{\sqrt {-{\mathrm {cot}\left (x\right )}^2-1}}\right ) \]

[In]

int((- cot(x)^2 - 1)^(1/2),x)

[Out]

atan(cot(x)/(- cot(x)^2 - 1)^(1/2))